package com.jysz.certificate.persistence.enums;

import com.jysz.certificate.persistence.model.system.Shop;
import com.jysz.certificate.persistence.model.system.User;
import com.jysz.webcore.ssh.web.convert.IEnum;

/**
 * 组织架构类型
 * 
 * @author <a href="mailto:javaengine@outlook.com">Kaca Rich</a>
 * 
 */
public enum OrganizationEnum implements IEnum{

	ORG("机构", 0, null), SHOP("店铺", 1, Shop.class), STAFF("人员", 2, User.class);

	// 名称
	private String name;
	// 索引
	private int index;

	private Class clazz;

	private OrganizationEnum(String name, int index, Class clazz) {
		this.name = name;
		this.index = index;
		this.clazz = clazz;
	}

	// 根据索引获得名称
	public static String getName(int index) {
		for (OrganizationEnum w : OrganizationEnum.values()) {
			if (w.getIndex() == index) {
				return w.name;
			}
		}
		return null;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public Class getClazz() {
		return clazz;
	}

	public void setClazz(Class clazz) {
		this.clazz = clazz;
	}

	public static OrganizationEnum valueOf(int index) {
		//TODO:
		return OrganizationEnum.ORG;
	}

	@Override
	public String toString() {
		return this.getName();
	}
}
